<div class="d-flex align-items-center login-content d-flex justify-content-center">
  <form [formGroup]="myForm" (ngSubmit)="onSubmit(myForm.value)"> 
    <h3 class="d-flex justify-content-center">用户登录</h3>
    <p *ngIf="myForm.invalid" class="text-danger">为什么不登陆</p>
    <p>{{name$|async}}</p>
    <div class="form-group">
      <label for="userName">用户名</label>
      <input type="text" class="form-control" id="userName" aria-describedby="输入用户名" name="userName"
      [formControl]="userName" [ngClass]="{'is-invalid':userName.invalid,'is-valid':userName.valid}">
      <div class="valid-feedback">
          用户名格式正确
      </div>
      <div class="invalid-feedback">
        <span *ngIf="userName.hasError('required')">
          用户名必须填写
        </span> 
         <span *ngIf="!userName.hasError('required') && userName.hasError('invalidUser')">
          用户名必须以admin开头
         </span> 
      </div>
    </div>
    <div class="form-group">
      <label for="password">密码</label>
      <input type="password" class="form-control" id="password" name="password" 
      [formControl]="password" [ngClass]="{'is-invalid':password.invalid,'is-valid':password.valid}">
      <div class="valid-feedback">
        密码填写正确
    </div>
    <div class="invalid-feedback">
       你在想什么，肯定是最少6位
     </div>
    </div>
    <button type="submit" class="btn btn-primary btn-block" (click)="login()" [routerLink]="['/management']">提交</button>
  </form>
</div>

<!-- <form [formGroup]="myForm" >
  <h3 class="d-flex justify-content-center">用户登录</h3>
    <div class="form-group">
      <label for="userName">用户名</label>
      <input type="text" class="form-control" id="userName" name="userName" [formControl]='userName'>
    </div>
    <div class="form-group">
      <label for="password">密码</label>
      <input type="password" class="form-control" id="password" name="password" [formControl]='password'>
    </div>
    <a class="btn btn-primary btn-block"  (click)="login()" [routerLink]="['/management']">登陆</a>       
 </form>
 </div>
  -->
  